import request from 'UTIL/request'

/**
 * 联系人列表
 * @param params
 */
export function GetList(params) {
  return request({
    url: 'crmContacts/queryPageList',
    method: 'POST',
    data: params,
    hideLoading: true
  })
}

/**
 * 联系人详情
 * @param params
 */
export function QueryById(params) {
  return request({
    url: `crmContacts/queryById/${params.contactsId}`,
    method: 'POST',
    data: params
  })
}

/**
 * 基本信息
 */
export function InformationById(params) {
  return request({
    url: `crmContacts/information/${params.id}`,
    method: 'POST',
    data: params
  })
}

/**
 * 新增/编辑时查询字段
 */
export function QueryFieldList(params) {
  const query = params && params.id ? `/${params.id}` : ''
  return request({
    url: `crmContacts/field${query}`,
    method: 'POST',
    data: params,
		requestType: 'form'
  })
}

/**
 * 联系人添加
 * @param params
 */
export function AddContacts(params) {
  return request({
    url: 'crmContacts/add',
    method: 'POST',
    data: params
  })
}

/**
 * 联系人编辑
 */
export function UpdateContacts(params) {
  return request({
    url: 'crmContacts/update',
    method: 'POST',
    data: params
  })
}

/**
 * 联系人转移
 * @param params
 */
export function Transfer(params) {
  return request({
    url: 'crmContacts/changeOwnerUser',
    method: 'POST',
    data: params
  })
}

/**
 * 联系人删除
 * @param params
 */
export function DeleteByIds(params) {
  return request({
    url: 'crmContacts/deleteByIds',
    method: 'POST',
    data: params
  })
}

/**
 * 联系人关联商机
 * @param params
 */
export function QueryBusiness(params) {
  return request({
    url: 'crmContacts/queryBusiness',
    method: 'POST',
    data: params
  })
}


/**
 * 联系人查看跟进记录
 * @param params
 */
export function GetRecord(params) {
  return request({
    url: 'crmContacts/getRecord',
    method: 'POST',
    data: params
  })
}

/**
 * 联系人添加跟进记录
 * @param params
 */
export function AddRecord(params) {
  return request({
    url: 'crmContacts/addRecord',
    method: 'POST',
    data: params
  })
}

/**
 * 查询联系人下附件列表
 * @param params
 */
export function QueryFileList(params) {
  return request({
    url: 'crmContacts/queryFileList',
    method: 'POST',
    data: params,
		header: {
			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
  })
}
